<html>
    <head>

		<#include "_head.html"/>
        
        <style>
        	.table {
				table-layout: fixed;
				width: auto;
			}
			.table th, .table td {
				text-align: center;
				vertical-align: middle!important;
			}
			
			.table td
			{
				padding-left: 0px;
				padding-right: 0px;
				padding-bottom: 10px;
				padding-top: 10px;
			}
			td p
			{
				width: 65% !important;
			}
			.rookie td {
				background-color: greenyellow !important;
			}
	
			.girl td {
				background-color: pink !important;
			}
			.main {
				width: 80%;
				min-width: 1280px;
				margin-bottom: 200px;
			}
      	</style>
    </head>
    <body background="assets/images/background.jpg">

		<#include "_mask.html" />

		<div class = "main container">
		<div class = "row-fluid">
		<div class="span12">
		<h1 style="text-align: center;">
			${contest.title}
		</h1>
		<#if msg??>
			<div align = "center">
				<div class="alert alert-warning" align="center" style="width: 20%;">
					<a href="#" class="close" data-dismiss="alert">
						&times;
					</a>
					<strong>${msg}</strong>
				</div>
			</div>
		 </#if>
		<#if reg && .now?long < (contest.startTime - 24*60*60) *1000 >
			<div align="center">
				<a href="contest/register/${contest.cid}" style="text-align: center;" class = "btn btn-info">
					<h3>比赛注册入口</h3>
				</a>
			</div>
		</#if>
		<#if  admin && !(contest.atime??) && (contest.startTime - 24*60*60) *1000 <= .now?long && .now?long <= contest.startTime*1000 >
			<div align="center">
				<a href="admin/generate/${contest.cid}" style="text-align: center;" class = "btn btn-info">
					<h3>生成比赛账号</h3>
				</a>
			</div>
		</#if>
			<div class=" pagination pagination-centered">
				<#include "_paginate2.html" />
				<@paginate currentPage = currentPage totalPage = totalPage actionUrl="contest/show/" + cid urlParas="${query!}"/>
			</div>
		<table class = "table table-stats table-responsive table-hover table-striped">
			 <colgroup>
				<col style="width:2.5%"> <!--序号 -->
				<col style= "width: 10%"> <!--队伍名-->
				<col style="width:5%"> <!--姓名 -->
				<col style="width:7%"> <!--学院 -->
				<col style="width:6%"> <!--班级 -->
				<col style="width:2.5%"> <!--性别 -->
				<col style="width:5%"> <!--姓名 -->
				<col style="width:7%"> <!--学院 -->
				<col style="width:6%"> <!--班级 -->
				<col style="width:2.5%"> <!--性别 -->
				<col style="width:5%"> <!--姓名 -->
				<col style="width:7%"> <!--学院 -->
				<col style="width:6%"> <!--班级 -->
				<col style="width:2.5%"> <!--性别 -->
				<col style="width:4%"> <!--状态 -->
				<#if admin || (uid != 0 && !reg)>
					<col style="width:4%"> <!--其他 -->
				</#if>
			</colgroup>
			<thead>
				<tr>
					<th>
					</th>
					<th>
					</th>
					<th colspan = "4">
						队员一
					</th>
					<th colspan = "4">
						队员二
					</th>
					<th colspan = "4">
						队员三
					</th>
					<th colspan="1">
					</th>
					<#if (uid != 0 && !reg) || admin>
						<th colspan="1">
						</th>
					</#if>
				</tr>
				<tr>
					<th>
						序号
					</th>
					<th>
						队名
					</th>
					<th>
						姓名
					</th>
					<th>
						学院
					</th>
					<th>
						班级
					</th>
					<th>
						性别
					</th>
					 <th>
						姓名
					</th>
					<th>
						学院
					</th>
					<th>
						班级
					</th>
					<th>
						性别
					</th>
					<th>
						姓名
					</th>
					<th>
						学院
					</th>
					<th>
						班级
					</th>
					<th>
						性别
					</th>
					 <th>
						状态
					</th>
					<#if uid != 0>
						<#if admin?? && admin>
							<th>
								管理
							</th>
						<#else>
							<#if !reg >
								<th>
									操作
								</th>
							</#if>
						</#if>
					</#if>
				</tr>
			</thead>
			<tbody>
				<#list TeamList as team>
				<#if team.isGirlTeam>
					<tr class = "girl">
				<#elseif team.isRookieTeam>
					<tr class = "rookie">
				<#else>
					<tr>
				</#if>
					<td>
						<#assign id = id + 1 />
						<#if team.isSpecialTeam>
							*${id}*
						<#else>

							${id}
						</#if>
					</td>
					<td>
						${team.teamNameChinese!}
						<#if team.teamNameChinese??><br></#if>
						${team.teamNameEnglish!}
					</td>
					<td>
						${team.name1!}
					</td>
					<td>
						${team.college1!}
					</td>
					<td>
						${team.class1!}
					</td>
					<td>
						<#if team.gender1??>
							<#if team.gender1 == "male">
								男
							<#else>
								女
							</#if>
						<#else>
						</#if>
					</td>
					<td>
						${team.name2!}
					</td>
					<td>
						${team.college2!}
					</td>
					<td>
						${team.class2!}
					</td>
					<td>
						<#if team.gender2??>
							<#if team.gender2 == "male">
								男
							<#else>
								女
							</#if>
						<#else>
						</#if>
					</td>
					<td>
						 ${team.name3!}
					</td>
					<td>
						${team.college3!}
					</td>
					<td>
						${team.class3!}
					</td>
					<td>
						<#if team.gender3??>
							<#if team.gender3 == "male">
								男
							<#else>
								女
							</#if>
						<#else>
						</#if>
					</td>
					<td>
						<#if team.status == 0>
							<p class="btn btn-info">Pending</p>
						<#elseif team.status == 1>
							<p class="btn btn-success" >Accepted</p>
						<#else>
							<p class="btn btn-danger" >Rejected</p>
						</#if>
					</td>
					<#if uid != 0>
						<#if admin?? && admin>
							<td>
								<a href="admin/${team.tid}" class="btn btn-info" style="width:60px">管理</a>
							</td>
						<#else>
							<#if !reg>
								<td>
									<#if uid == team.uid>
										<a href="contest/detail/${team.tid}" class="btn btn-warning" style="width:60px">查看详情</a>
									</#if>
								</td>
							</#if>

						</#if>
					 </#if>
				</tr>
				</#list>
			</tbody>
			<p style="font-weight: 900" align="center">
				总计：${accepted}支正式队</br>
				<font color="red" >女生队：${girl}</font></br>
				<font color="green">新人队：${rookie}</font>
			</p>
		</table>
		</div>
		</div>
		</div>
		<#include "_modal.html"/>
	</body>
</html>
